TARGET_PATH?=/dev/null

all:compile

config_env:
	mkdir node_tmp && cd node_tmp && \
		wget https://nodejs.org/dist/v22.12.0/node-v22.12.0-linux-x64.tar.xz && \
		tar xf node-v22.12.0-linux-x64.tar.xz && \
		mkdir -p /usr/local/soft && \
		cp ./node-v22.12.0-linux-x64 /usr/local/soft/ -a && \
		ln -sf /usr/local/soft/node-v22.12.0-linux-x64/bin/node /usr/local/bin/node && \
		ln -sf /usr/local/soft/node-v22.12.0-linux-x64/bin/npm /usr/local/bin/npm && \
		ln -sf /usr/local/soft/node-v22.12.0-linux-x64/bin/npx /usr/local/bin/npx && \
		npm i lv_i18n -g; \
		cd - && rm node_tmp -r

compile:
	@echo "compile start lv_i18n"
	@ls lv_i18n_src > /dev/null 2>&1 || mkdir lv_i18n_src
	@/usr/local/soft/node-v22.12.0-linux-x64/lib/node_modules/lv_i18n/lv_i18n.js compile -l zh-CN -t "./*.yml" -o ./lv_i18n_src
	@echo "compile end lv_i18n"

cp:compile
	@echo "cp to ${TARGET_PATH}"
	@cp lv_i18n_src/* ${TARGET_PATH}

clean:
	@rm -rf lv_i18n_src
